package com.velpro.im.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.util.JSONPObject;
import com.velpro.im.controller.msg.ObjectResponse;
import com.velpro.im.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/config")
//@RefreshScope
public class ConfigController {
	
	@Autowired
    private UserService userService;
	/*
	@Autowired
    private UserMapper userMapper;*//*

	@Resource
	private RedisUtils redisUtils;
	
	@Resource
	private MqSender mqSender;*/
	
	/*@Value("${server.port}")
    private String test;*/

	@RequestMapping("/info")
	@ResponseBody
    public ObjectResponse<String> info(Model model, HttpServletRequest req , HttpServletResponse resp) {
    	//User user = userService.get(15405L);
    	//System.out.println(user.getName());
    	//redisUtils.set("_____", "test");
		/*System.out.println(AppProperties.ins.APP_ID);
		System.out.println(AppProperties.ins.APP_NAME);
		System.out.println(req.getHeader("token"));*/
        //return WebContextHandler.getLoginName();
        return null;//new ObjectResponse<String>().data(WebContextHandler.getLoginName());
    }
	
    @PostMapping("/get1")
    @ResponseBody
    public ObjectResponse<String>  get(Model model,HttpServletRequest req , HttpServletResponse resp) {
    	//String a = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
    	//resp.setHeader("token", "_tggggg");


        return new ObjectResponse<String>().data("success");
    }
	
    @RequestMapping("/mq")
    @ResponseBody
    public String mq(Model model) {
    	//mqSender.send();
        return "index";
    }
}
